/*
 * 作者:熊猫
 * 日期:2017 - 3 - 14 7 - 53 - 34
 *
 */

package net.lainiao.other.demo3;

/**
 * Created by Administrator on 2017/3/14.
 */
public class MyHander {

    public   void mainThreadDo(int i) throws InterruptedException {
        synchronized (this){
            for (int j = 1; j <= 20; j++) {
                System.out.println("主线程第"+i+"轮,第"+j+"次");
            }
            this.notify();
            this.wait();
        }
    }

    public   void childThreadDo(int i) throws InterruptedException {
        synchronized (this){
            for (int j = 1; j <= 30; j++) {
                System.out.println("子线程:"+i+"轮第"+j+"次");
            }
            this.notify();
            this.wait();
        }
    }
}
